package au.chao.client.frame.chat;

import java.awt.BorderLayout;

import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ListSelectionModel;

public class ChatPanelLeft extends JPanel {
	private static final long serialVersionUID = 1L;

	private JScrollPane scrollPanel;
	private JList list;
	private String[] friends = null;

	public ChatPanelLeft(ChatFrame parent) {
		init();
	}

	private void loadFriendList() {
		friends = new String[] { "Bird", "Cat", "Dog", "Rabbit", "Pig",
				"dukeWaveRed", "kathyCosmo", "lainesTongue", "left", "middle",
				"right", "stickerface" };
	}

	private void init() {
		loadFriendList();
		list = new JList(friends);
		list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		list.setSelectedIndex(0);
		scrollPanel = new JScrollPane(list);
		setLayout(new BorderLayout());
		add(scrollPanel);
	}

	public Object getSelectedItem() {
		return list.getSelectedValue();
	}
}
